package Test;

import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;

public class TestThreads {

	public static void main(String[] args) throws InterruptedException {
		ExecutorService threadPool = Executors.newFixedThreadPool(5);
		DogCallable dc = new DogCallable();
		
		
		Future<String> f1 = threadPool.submit(dc);
		
		Thread.sleep(10000);
		Future<String> f2 = threadPool.submit(dc);
		try {
			System.out.println("f1"+f1.get());
			System.out.println("f1"+f1.get());
		} catch (InterruptedException e) {
			
			e.printStackTrace();
		} catch (ExecutionException e) {
			
			e.printStackTrace();
		}
		
		threadPool.shutdown();
		

	}

}
